
<style lang="scss" scoped>
  @import 'src/styles/mixins';
  @import 'src/styles/common';
  @import 'src/styles/company/index';
  .sidebar{
    width:254px;
  }
  // company框架
      .logoAndName{
        padding:20px;
  .logo{
    float: left;width: 66px;height: 66px;margin-right:10px;
  }
  .names{
    float: left;width:120px;
  .name{
    font-size: 20px;width: 100%;color: #333333;line-height: 30px;height: 30px;margin-top:10px;
  }
  .job{
    font-size: 14px;width: 100%;color: #666;line-height: 30px;height: 30px;
  }
  }
  }
  .acountInfo{
    padding:5px 20px;line-height: 30px;background: #fafafa;
  .acountName{
    font-size:14px;color: #666;border-bottom:1px #e5e6e7 solid;
  i{
    color:#333;
  }
  }
  .acountAsk{
    font-size:12px;color: #727272;
  i.num{
    color:#ffad33;font-size:20px;padding:0 10px;cursor: pointer;
  }
  a{
    margin-left:10px;color: #9b9898;
  }
  }
  }
  .l-menu{
    padding:30px;
    a{
      border-bottom:1px #eee dashed;display:block;
        span.name{
          font-size: 14px;color: #333333;float: left;text-align: left;line-height: 48px;
        }
        i.icon{
          width:7px;display: block;float: right;height:12px;margin-top:20px;background: url('/static/images/web/company/icons/rightTips.png') no-repeat;
        }
    }
    a.cur{
      span.name{
        color: #0078ff;
      }
      i.icon{
        background: url('/static/images/web/company/icons/rightTipsCur.png') no-repeat;
      }
    }
  }
</style>
<template>
  <div>
    <div class="logoAndName">
      <div class="logo">
        <img :src="`/api/pub/image/${companyUserInfo.avatar}`" alt="logo" width="66" height="66">
      </div>
      <div class="names">
        <div class="name">HI <i>{{companyUserInfo.realName}}</i></div>
        <div class="job">职务： <i>{{companyUserInfo.job}}</i></div>
      </div>
      <div class="clear"></div>
    </div>
    <div class="acountInfo">
        <div class="acountName">账户名称：<i>{{companyUserInfo.username}}</i></div>
        <div class="acountAsk">收到简历：<i class="num" @click="goTolook">{{count}}</i><i>份</i></div>
      <!--<a @click="goTolook()">去查看>></a>‘份’放后面-->
    </div>
    <!--menu-->
    <div class="l-menu">
      <a @click.stop="goTo(item.url)" :key="index" v-for="(item, index) in menuList" :class="isActive===item.url?'cur':''"><!--class="cur" 当前选择样式为：cur-->
        <span class="name">{{item.name}}</span>
        <i class="icon icon-drop"></i>
        <div class="clear"></div>
      </a>
    </div>
  </div>
</template>

<script>
  import { mapState, mapMutations, mapActions } from 'vuex';
  import { noticeCount } from '@/service/company/myAccount/myAccountMService';
  export default {
    data () {
      return {
        menuList: [
         {id: 1, name: '简历管理', url: '/company/main/resume'},
          {id: 2, name: '职位管理', url: '/company/main/station'},
          // {id: 3, name: '人才库', url: '/company/main/talentPool'},
          {id: 4, name: '简历中心', url: '/company/main/companyCenter'},
          {id: 5, name: '职位邀请', url: '/company/main/jobInvitation'},
          {id: 6, name: '子账号管理', url: '/company/main/subaccount'},
          {id: 7, name: '企业信息', url: '/company/main/enterpriseInfo'},
//          {id: 8, name: '活动申请', url: '/company/main/activities'},
          {id: 9, name: '我的信息', url: '/company/main/myAccount'}
        ],
        count: 0
      };
    },
    computed: {
      ...mapState([
        'sidebar_an',
        'companyUserInfo',
        'currentCompanyInfo'
      ]),
      isActive: function () {
        return this.$route.path;
      }
    },
    async created () {
      if (!this.companyUserInfo.realName) await this.getCompanyUserInfo();
      this.noticeCount();
      if (this.companyUserInfo.role !== 'companyRoot') {
        this.menuList.splice(4, 1);
        this.menuList.splice(4, 1);
      } else {
        if (!this.currentCompanyInfo.name) await this.getCurrentComp();
      }
    },
    mounted () {
      this.$nextTick(() => {});
    },
    methods: {
      ...mapMutations([
        'SIDEBAR_AN'
      ]),
      ...mapActions([
        'getCompanyUserInfo',
        'getCurrentComp'
      ]),
      goTo (link) {
        if (!link) return;
        this.$router.push(link);
      },
      // 查询通知消息条数
      async noticeCount () {
        let result = await noticeCount();
        this.count = result.data || 0;
      },
      goTolook () {
        this.$router.push('/company/main/resume');
      }
    }
  };
</script>

<style lang="scss" scoped>
  .sidebar{
    padding-top: 30px;
    width: 180px;
    height: 100%;
    border-right: 1px solid #fff;
  }
  .ivu-menu-item {
    color: #797979;
    &:hover{
      color: #39f;
    }
  }
  .ivu-avatar-large {
    margin-left: 20px;
    width: 50px;
    height: 50px;
  }
</style>
